package com.joysuch.wwyt.core.mapper;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.joysuch.wwyt.api.base.dto.ApiUserBeanDto;
import com.joysuch.wwyt.api.base.dto.ApiUserDto;
import com.joysuch.wwyt.bp.bean.BpBaseUserBean;
import com.joysuch.wwyt.core.bean.BaseRoleUserListBean;
import com.joysuch.wwyt.core.bean.BaseUserDepartBean;
import com.joysuch.wwyt.bp.bean.BpBaseUserJobBean;
import com.joysuch.wwyt.core.bean.SimpleUserBean;
import com.joysuch.wwyt.core.entity.BaseUser;
import com.joysuch.wwyt.edu.bean.EduCertUserDto;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author zero
 * @since 2021/11/2 14:18
 */
public interface BaseUserMapper extends BaseMapper<BaseUser> {
    List<EduCertUserDto> findUserList(String name, String enterPrise, Long departId, Long tenentId, String orgCode);

    List<EduCertUserDto> findContractUser(String nameOrCode, String companyName, Long tenentId, String orgCode);

    List<SimpleUserBean> findUserByJobId(Long jobId);

    List<SimpleUserBean> findAllUser();

    int selectuserCount(String name, String enterPrise, Long departId, Long tenentId, String orgCode);

    int selectContractorCount(String nameOrCode, String companyName, Long tenentId, String orgCode);

    List<ApiUserDto> findUserListForApi(Set<Long> departIdList, List<Long> jobIdList, List<Long> roleIdList, List<Long> userIdList, Long tenantId, String orgCode);

    Page<ApiUserDto> findUserListByPageForApi(Page<ApiUserDto> apiUserVoPage, List<Long> departIdList, List<Long> jobIdList, List<Long> roleIdList, List<Long> userIdList,
                                              String userName,
                                              String departName,
                                              String code,
                                              Long tenantId,
                                              String orgCode);

    List<BaseUser> selectByNameDuty(QueryWrapper<BaseUser> queryWrap);

    List<Long> findUserIdsByJobTargetIds(@Param("targetIds") List<Long> targetIds);


    List<Long> findUserIdsByDepartTargetIds(@Param("targetIds") List<Long> targetIds);

    List<BaseUser> findByUserIds(@Param("ids") List<Long> ids);

    List<Long> findDepartByJobId(@Param("jobId") Long jobId);

    List<Long> findJobByDepartId(@Param("departId") Long departId);

    Long selectUserIdByName(@Param("userName") String userName);

    Long countNumByName(@Param("userName") String userName);

    List<ApiUserBeanDto> findUserBeanListForApi(List<Long> userIdList, List<String> userNameList, Long tenantId, String orgCode);

    BaseUser findByUserId(@Param("id") Long id);

    List<BpBaseUserJobBean> getUserJobBeanList(@Param("ids") List<Long> ids);

    List<BaseUserDepartBean> findUserByDepart(@Param("jobIds") List<Long> jobIds, @Param("departIds") List<Long> departIds, @Param("userIds") List<Long> userIds);

    List<BpBaseUserBean> findUserNamesByUserIds(@Param("ids") List<Long> examinerUserIds);

    List<BaseUser> selectByUserList(@Param("absentUsers") List<Long> absentUsers);
}
